package com.meisupic.copyright.amdin.controller;

import com.meisupic.copyright.domain.vo.VipUserVo;
import com.meisupic.copyright.service.IAccountService;
import com.meisupic.copyright.support.PageResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin/vip")
public class VipController {

  @Autowired
  IAccountService accountService;

  @GetMapping(value = "/page")
  public PageResponse<VipUserVo> queryUserPage(Pageable pageable) {
    PageRequest pageRequest = new PageRequest(pageable.getPageNumber() - 1, pageable.getPageSize(),
        pageable.getSort());
    return accountService.getVipUsers(pageRequest);
  }
}
